class Student:
    def __init__(self, name, age):
        self.nm = name
        self.ag = age

    def __str__(self):
        return f'姓名：{self.nm}，年龄：{self.ag}'

    def eat(self):
        print(f'{self.nm}要吃饭')

    def sleep(self):
        print(f'{self.nm}要睡觉')

    def year(self):
        self.ag += 1


xm = Student('小明', 18)
xh = Student('小红', 17)
xm.eat()
xm.sleep()
xm.year()
print(xm)
xh.eat()
xh.sleep()
xh.year()
print(xh)


class Computer:
    def __init__(self, brand, price):
        self.brand = brand
        self.price = price

    def play_movie(self, movie_name):
        print(f'价格为{self.price}的{self.brand}电脑播放电影{movie_name}')


xmcpu = Computer('小米', 5020)
apcpu = Computer('苹果', 5000)
xmcpu.play_movie('葫芦娃')
apcpu.play_movie('变形金刚')
